Skip to content

fix(mac): route the server's no-admin refusal back to the setup wizard - #236

Merged
dvcdsys merged 1 commit into
developfrom
fix/first-run-empty-db
Aug 10, 2026
Merged

fix(mac): route the server's no-admin refusal back to the setup wizard#236
dvcdsys merged 1 commit into
developfrom
fix/first-run-empty-db

Conversation

@dvcdsys

@dvcdsys dvcdsys commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Problem

After rm -rf ~/.cix/data, clicking Start showed the raw cix-server.err tail ("incomplete bootstrap configuration…") instead of the setup wizard.

The mechanism: the first start attempt recreates an empty cix.db — the server runs MkdirAll + migrations before bootstrapAuth refuses. From that moment needsFirstRun()'s file-existence check answers false, so the wizard branch added in #235 never fires and the user gets the log dump.

Fix

The one thing that still knows the database has no accounts is the server itself, so recognise its refusal:

  • isBootstrapRefusal(logTail) matches the two bootstrapAuth messages a user-less database produces ("incomplete bootstrap configuration", "no users in database").
  • toggleServer routes a matching died-on-start log to the same "Set cix up again?" offer as a missing database (extracted into offerSetupAgain). Other startup failures — port clash, unreadable DB file — still show the log tail; they are not reasons to offer re-setup.
  • The wizard's email prompt now prefills the address already in server.env, since a re-run almost always wants the same one.

Testing

  • TestIsBootstrapRefusal pins both refusal strings (copied from bootstrap.go) and rejects unrelated failures; existing launcher tests green.
  • Live state on the dev Mac matches the diagnosis exactly: 331 KB schema-only cix.db, retired bootstrap password, refusal in the log tail. A fresh DMG is built for end-to-end verification.

🤖 Generated with Claude Code

Deleting ~/.cix/data does not stay a "missing database" for long: the very
next start attempt recreates an empty cix.db (the server runs migrations
before bootstrapAuth refuses), so needsFirstRun's file-existence check
answers false from then on, and Start showed the raw refusal from
cix-server.err instead of offering setup.

The reliable signal for "no accounts" is the server's own refusal text, so
recognise it: isBootstrapRefusal matches the two bootstrapAuth messages a
user-less database produces, and toggleServer routes a matching
died-on-start log to the same set-up-again offer as a missing database.
Other startup failures still show the log tail — a port clash is not a
reason to offer re-setup.

Also prefill the wizard's email prompt with the address already in
server.env, since a re-run almost always wants the same one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@dvcdsys
dvcdsys merged commit cfd78ee into develop Aug 10, 2026
2 checks passed
@dvcdsys
dvcdsys deleted the fix/first-run-empty-db branch August 10, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant